﻿using InfonavaEye.util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace InfonavaEye.Forms
{
    public partial class PickBoxModelForm : Form
    {
        public string boxModelName { get; set; }

        public PickBoxModelForm()
        {
            InitializeComponent();
        }

        private void btnSure_Click(object sender, EventArgs e)
        {
            this.boxModelName = this.cmbBox.Text;
            if (String.IsNullOrEmpty(this.boxModelName)) {
                MessageBox.Show("请选择钉盒模型");
                return;
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnBack_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void PickBoxModelForm_Load(object sender, EventArgs e)
        {
            var baseDir = FileHelper.getBaseDir();
            DirectoryInfo TheFolder = new DirectoryInfo(baseDir+"\\BoxModel");
            foreach (FileInfo file in TheFolder.GetFiles()) {
                this.cmbBox.Items.Add(file.Name.Replace(".json",""));
            }
        }
    }
}
